1. Field of the Invention
The present invention relates to an image processing unit and method for a plurality of polygons including translucent (semi-transparent) polygons, and more particularly to an image processing unit and method which can convert polygon data to image data sequentially from the polygon at the front in a display screen, even for translucent polygons. The present invention also relates to an image processing unit and method which can perform blending processing for a plurality of polygons sequentially from the polygon at the front in the display screen.
2. Description of the Related Art
In game machines and simulation machines, the positions of a plurality of polygons constituting a character or other objects are determined according to the operation input, image data is generated by executing rendering processing for polygons to be displayed among these polygons, and the image data is displayed.
Unlike for opaque polygons, the rendering processing for translucent polygons involves blending processing with another polygon positioned behind (back side), and conventionally rendering processing, including blending processing, must be performed sequentially from the translucent polygon at the back in the display screen.
In rendering processing for opaque polygons, on the other hand, overlapping portions are processed without any restrictions in the rendering sequence of a plurality of polygons by performing hidden-surface removal processing using Z-values, which indicate depth in the display screen. When opaque polygons and translucent polygons coexist, a general method is to process the opaque polygons in any sequence by the above hidden-surface removal processing using Z-values, then to process the translucent polygons sequentially from the back.
When the number of polygons to be processed increase in rendering processing, however, rendering processing may not complete within the predetermined time between frames. If greater importance is placed on the quality of image processing in such a case, the image processor must wait until rendering for all translucent polygons ends, which stops the movement of characters being displayed, and is inappropriate for a game machine or simulation machine. If greater importance is placed on the movement of characters, some polygons remain unprocessed within the time between frames. In such a case, rendering processing of translucent polygons is executed sequentially from the back, therefore processing of polygons at the front, which are the most important characters in the image, is ignored.
In addition, rendering processing for opaque polygons and translucent polygons must be processed separately if the respective efficiency of processing is considered, as mentioned above, which increases burden on image processing. Such an increased burden also makes it difficult to complete image processing within the time between frames.
It is proposed that not only in blending processing, using the opacity (or transparency) of translucent polygons, but also in general blending processing, color data is determined sequentially from the polygon at the back in the display screen, and blending processing is executed for the color data and the color data of the polygon to be processed next by using a predetermined source mixing coefficient and a destination mixing coefficient. In this case as well, processing sequentially from the polygon at the back in the display screen is demanded, where the same problems remain as in the case of processing for translucent polygons.
It is accordingly an object of the present invention to provide an image processing unit and method which can execute rendering processing of polygons at the front within the time between frames without fail in image processing for translucent polygons, and a recording medium where a program for a computer to execute the image processing is recorded.
It is another object of the present invention to provide an image processing unit and method which can execute rendering processing without differentiating between opaque polygons and translucent polygons so as to improve processing efficiency in the image processing for polygons where opaque polygons and translucent polygons coexist, and a recording medium where a program for a computer to execute the image processing is recorded.
It is still another object of the present invention to provide an image processing unit and method with high processing efficiency in general blending processing, and a recording medium where a program for a computer to execute the image processing is recorded.
To achieve the above objects, one aspect of the present invention is characterized in that the rendering processing of translucent polygons is executed sequentially from the polygon at the front in the display screen. For this, when the color data Tn and the opacity xcex1n are provided to the nth polygon of the polygons sequentially arranged from the front in the display screen, work data Xn is determined as
Xn=(1xe2x88x92xcex1n)xc2x7Xnxe2x88x921,
then image data Dn is determined as
Dn=Dnxe2x88x921+Tnxc2x7xcex1nxc2x7Xnxe2x88x921
and the above arithmetic processing for determining the work data Xn and the image data Dn is executed for all polygons, and the last image data Dn is used as the image data for display. In the above processing, the initial value X0 of the work data Xn is preferably 1, for example, and the initial value Do of the image data Dn is preferably 0, for example.
According to the above image processing, translucent polygons can be sequentially processed from the front, so even if the time between frames is short, rendering processing for the polygons positioned at the front, which are more significant, in the display screen is not omitted. As a consequence, images with smooth movement can be reproduced without stopping movement of important characters comprised of the polygons.
The above mentioned work data Xn indicates an accumulated value of the transparency (1xe2x88x92xcex1) of the n number of translucent polygons. When a plurality of polygons overlap, rendering processing is executed sequentially from the polygon at the front, and in the rendering processing for respective polygons, the color data Tn of the polygon at the back is added to the image data Dnxe2x88x921 for the overlapped (nxe2x88x921) number of polygons in front according to the value Xnxe2x88x921, which is an accumulated transparency value of the (nxe2x88x921) number of polygons in front.
Therefore, in the present invention, it is necessary to determine and record the accumulated transparency value of the overlapped polygons for each pixel while executing the above rendering processing sequentially from the polygon at the front.
In the rendering processing for each polygon, it is preferable to added the color data Tn according to the opacity of the currently processing polygon. In other words, it is preferable to add the component of color data Tn according to the opacity xcex1n of the currently processing polygon to the image data Dnxe2x88x921 of the (nxe2x88x921)number of overlapped polygons according to the accumulated value Xnxe2x88x921 of the transparency (1xe2x88x92xcex1) of the (nxe2x88x921)th polygon, which is at the front of the currently processing polygon.
To achieve the above objects, another aspect of the present invention is an image processing unit which executes image processing for a plurality of polygons, including translucent polygons, to generate image data to be displayed, comprising: a rendering processing part where the color data Tn and the opacity xcex1n or the transparency (1xe2x88x92xcex1n) are provided to the nth polygon of the polygons sequentially arranged from the front in the display screen, the color data Tn and the opacity xcex1n or the transparency (1xe2x88x92xcex1n) of the above mentioned polygon are supplied to the polygons sequentially from the front, and the color data Tn of the nth polygon is added to the image data Dnxe2x88x921 up to the nxe2x88x921th polygon according to the accumulated transparency value Xnxe2x88x921 of the (nxe2x88x921) number of polygons positioned at the front.
Preferably in the above invention, the above rendering processing part adds the components for the opacity xcex1n of the nth polygon out of the color data Tn of the nth polygon to the image data Dnxe2x88x921 up to the (nxe2x88x921)th polygon according to the accumulated transparency value Xnxe2x88x921 of the (nxe2x88x921) number of polygons positioned at the front.
According to the above invention, a plurality of translucent polygons can be rendered sequentially from the front. Therefore the quality of image data is not diminished even if the processing of all polygons do not end within the time between frames.
Also in the above invention, more preferable embodimemt is characterized in that the above polygons include the translucent polygons and opaque polygons, and the opacity xcex1n of the translucent polygon is set to 1 greater than xcex1n greater than 0, and the opacity xcex1n of the opaque polygon is set to xcex1n=1. According to this embodiment, polygons can be rendered sequentially from the front without differentiating between translucent polygons and opaque polygons.
Also in the above invention, more preferable embodiment is characterized in that the above rendering processing part omits processing for the nth or latter polygons when the above accumulated transparency value is zero transparency or less than a predetermined minimum value Xmin in the processing for the nth polygon. Because of the above configuration, the processing of a polygon overlapping behind (at the back of) an opaque polygon and the processing of a polygon overlapping behind (at the back of) a translucent polygon having a higher opacity a can be omitted and the efficiency of rendering processing can be improved.
To achieve the above objects, in another aspect of the present invention, polygons are sequentially processed from the front in the display screen for general blending processing as well. This invention is an image processing unit which executes predetermined blending processing for a plurality of polygons to generate image data to be displayed, comprising: a rendering processing part where the color data Tn and data on a destination mixing coefficient DEn and source mixing coefficient SRn are provided to the nth polygon of the polygons sequentially arranged from the front in the display screen, then the color data Tn, the destination mixing coefficient DEn and the source mixing coefficient SRn of the polygon are supplied to the polygons sequentially from the front, and the color data Tn of the nth polygon is added to the image data Dnxe2x88x921 up to the (nxe2x88x921)th polygon according to the above destination mixing coefficient DEn and the accumulated value Xnxe2x88x921 of the source mixing coefficients SR1-SRnxe2x88x921 of the (nxe2x88x921)polygons positioned at the front.
By selecting an appropriate destination mixing coefficient DEn and source mixing coefficient SRn in the above invention, various blending processings can be executed and the rendering processing part which executes general blending processing can be provided.
The present invention also provides an image processing method of the above processor and a recording medium where a program for a computer to execute the image processing method are recorded.